library(tidyverse)


dat = data.table::fread("results/time_df.csv")


## Plot: dot plot
## methods in the Y axis
## time (or log time) on the X axis
## dots indicating time

dat2 = reshape2::melt(dat, "samps")
dat2$k = factor(dat2$samps)

levs = levels(dat2$variable)
levs = levs[!levs %in% c("topics_taddy", "distil_recon",
                      "roberta_kld")]
levs = c("topics_taddy", "distil_recon",
         "roberta_kld", levs)
levs = rev(levs)

dat2$variable = factor(dat2$variable,
                       levels = levs)

ggplot(dat2, aes(x = value, y = variable)) + 
  geom_point(aes(shape = k)) +
  theme_bw() +
  xlab("Time (seconds)") +
  ylab("Method")


ggsave("results/figA3_time.pdf")


## In-text numbers
dat$topics_taddy

quantile(as.numeric(dat[1,]), seq(0.4,0.6,length.out = 50))
quantile(as.numeric(dat[2,]), seq(0.4,0.6,length.out = 50))
quantile(as.numeric(dat[3,]), seq(0.4,0.6,length.out = 50))
quantile(as.numeric(dat[4,]), seq(0.4,0.6,length.out = 50))

dat$distil_recon[4]/dat$topics_taddy[4]
dat$roberta_kld[4]/dat$topics_taddy[4]
